/*
 * @Descripttion: 
 * @version: 
 * @Author: LEO
 * @Date: 2021-05-08 10:14:36
 * @LastEditors: LEO
 * @LastEditTime: 2021-05-08 13:55:30
 */

const i18NT = window.$app.t;

export const MAIN_TABLE_CONFIG = [
  { title: i18NT('workflowName'), dataIndex: 'workflowName',width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('workflowType'), dataIndex: 'workflowTypeName',width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('businessName'), dataIndex: 'businessName',width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('businessComment'), dataIndex: 'businessComment',width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('applyUserName'), dataIndex: 'applyUserName',width: 150, ellipsis: true, tooltip: true },
  {
    title: i18NT('currentAssignUserName'),
    dataIndex: 'TodoTasks',
    render: (arg: any) => {
      return (arg as { assignUserName: string }[])?.map(item => item.assignUserName).join(', ')
    },
    width: 150, ellipsis: true
  },
  { title: i18NT('taskName'), dataIndex: 'taskName', render: (text: string, record: any) => record.TodoTasks?.[0]?.taskName,width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('reason'), dataIndex: 'reason',width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('reqCreatedAt'), dataIndex: 'createdAt', format: 'time',width: 150, ellipsis: true, tooltip: true },
  { title: i18NT('status'), dataIndex: 'status',width: 150, ellipsis: true, tooltip: true },
  {title: i18NT("action"), dataIndex: "action", width: 90, fixed: 'right' }
]

export const WORKFLOW_STATUS = {
  10: i18NT('statusInCreated'),
  20: i18NT('statusInProgress'),
  30: i18NT('statusInDony'),
  40: i18NT('statusInError')
}

export const STATUS = {
  'progress':'10',
  'doprogress':'20',
  'done':'30',
  'error':'40',
  'withdraw':'50',
}


export const HISTORY_STATUS = {
  10: i18NT('historyPass'),
  20: i18NT('historyRefuse'),
  30: i18NT('historyConvert'),
  40: i18NT('historyBack')
}

export const HISTORY_TABLE = [
  { dataIndex: 'createdAt', title: i18NT('approveTime'), format:'time' },
  { dataIndex: 'assignUserName', title: i18NT('approveUser') },
  { dataIndex: 'taskName', title: i18NT('approveNode') },
  { dataIndex: 'action', title: i18NT('approveAction'), render: (text: string) => HISTORY_STATUS[text] },
  { dataIndex: 'comment', title: i18NT('approveComment') }
]